Ext.ns('Wlanauth.user');

Wlanauth.user.FormPanel = Ext.extend(Wlanauth.BaseFormPanel,{
	
	constructor:function(config){
		Ext.apply(this,config);
		
		var formID = new Date().getTime();
		
		/*var photoHidden = new Ext.form.Hidden({
			//name:'user.photo'
		});*/
	 	this.photoPanel = new Zt.widgets.PicPanel({
	 		 baseUrl:'../',
	         savePath:'upload',
			 url:'imgUpload.action',
			 picLabel:'用户头像',
	 		 photoField:null,
	 		 picWidth:150
	 	});
	 	
	 	Wlanauth.user.FormPanel.superclass.constructor.call(this,{
			actionClass:'user',
			
			layout:'column',
	         waitMsgTarget: true,
	         defaults:{xtype:'textfield',layout:'form',labelWidth:40},
	         items: [{
                 columnWidth: .70,
                 xtype:'panel',
                 layout:'form',
                 defaults:{xtype:'textfield',anchor:'90%'},
                 items:[{fieldLabel:'绑定IP',name:'entity.bindIP',allowBlank:false,maxLength:12,afterLabelTextTpl: this.requiredTpl},
                        {fieldLabel:'用户名',name:'entity.username',allowBlank:false,maxLength:25},
                        {fieldLabel:'姓名',name:'entity.displayname',allowBlank:false},
                        {fieldLabel:'密码',name:'entity.password',value:'111',allowBlank:false},
                        {fieldLabel:'重复密码',name:'password2',value:'111',allowBlank:false},
                        {fieldLabel:'总流量(KB)',name:'entity.maxOctets',value:'100000',allowBlank:false},
                        {fieldLabel:'性别',name:'entity.sex.id',xtype:'remotecombo',url:'dictionary!listSex.action?d='+new Date().getTime(),
                        	root:'rows',
                        	fields:['name','id']},
                        {fieldLabel:'激活日期'}
                        {fieldLabel:'生日',name:'entity.birth',xtype:'datefield',format:'Y-m-d h:m:s'}
                       ]
                 },{
                   columnWidth: .30,
                   xtype:'panel',
                   items:this.photoPanel
                 },{
                  columnWidth:1,
                  layout:'form',
                  xtype:'panel',
                  defaults:{xtype:'textfield',anchor:'100%'},
                  items:[{fieldLabel:'邮箱',name:'entity.email',allowBlank:true,vtype:'email'},
                         {fieldLabel:'备注',xtype:'textarea',name:'entity.desc',allowBlank:true}]
                         },{
         			xtype:'hidden',
         			name:'entity.id'
         		}],
         		onLoadDataSuccess:function(form,action){
         			var r=  action.result;
         			if(r.success&&r.data.sexId!=null){
         				form.findField('sex.id').setValue(r.data.sexId);
         			}
         		}
         	});
	}
});

Ext.reg('wlanauth.user.formpanel',Wlanauth.user.FormPanel);